include:
  - nginx.service
{% if 'vhost' in pillar %}
{% for eachvhost in  pillar['vhost'] %}
{% set vhost_id = 'web-vhost-' + eachvhost.name %}
{{ vhost_id }}:
  file.managed:
    - name: {{ eachvhost['target'] }}
    - source: {{ eachvhost['source'] }}
    - watch_in:
      - service: nginx
{% endfor %}
{% endif %}
